/*
 *  Charge.h
 *  powaah
 *
 *  Created by Tim Uusitalo on 4/3/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef CHARGE_H

#define CHARGE_H

#include "Vector2.h"


class Charge
{
public:

	/// Default Constructor
	Charge();
	
	/**
	 * Constructor
	 * @param c - the charge
	 * @param a - the angle for the current charge
	 */
	Charge(const float c, const float a);
	
	/// Destructor
	~Charge();
	
	/**
	 * Updates the current potential
	 */
	void update();
	
	/**
	 * Sets charge
	 * @param c - incoming charge
	 */
	void setCharge(const float c);
	
	/**
	 * Sets the angle for the current charge
	 * @param a - incoming angle
	 */
	void setAngle(const float a);
	
	/**
	 * Sets length
	 * @param length - incoming length
	 */
	void setLength(const float length);

	/**
	 * Sets position of the angle
	 * @param pos - incoming position
	 */
	void setPos(const int pos);
	
	/**
	 * Returns the charge
	 */
	const float getCharge() const;
	
	/**
	 * Returns the angle
	 */
	const float getAngle() const;
	
	/**
	 * @returns the length
	 */
	const float getLength() const;

	/**
	 *
	 * @returns the position
	 */
	const int getPos() const;

	/**
	 * @return - current potential
	 */
	const float getPotential() const;
	
	const Vector2 getPosition() const;
	
	/**
	 * Calculate a potential between two different charges according to
	 * coulomb's law
	 * @param c1 - the first charge
	 * @param c2 - second charge
	 * @param distance - the distance between the charges
	 * @return - Potential between the charges
	 */
	static const float getPotentialFromCharges(const Charge& c1, const Charge& c2, const float distance);
	static const float getPotentialFromChargesDistanceNonSquared(const Charge& c1, const Charge& c2, const float distance);
private:
	float charge;
	float angle;
	float length;
	int pos;
	float potential;
	
	Vector2 position;

	static const float MAX_LENGTH;
	
};

#endif
